<!DOCTYPE html>
<html>
<head>
  <title>查询结果</title>
</head>
<body>
<a href="router.php?c=user&m=listusers">用户列表</a>
<a href="router.php?c=video&m=listvideos">用户列表</a>
<h1><center>查询结果</center></h1>
 <table align="center" border="1"> 
 <tr>
  <th>视频ID</th>
  <th>视频名称</th>
  <th>视频类型</th>
  <th>海报</th>
  <th>内容简介</th>
  <th>添加日期</th>
  <th>上传用户</th>
  <th>点击率</th>
  <th>下载量</th>
  <th>下载地址</th>
  <th>操作</th>
 </tr>

<?php
  define('UserPhotoPath','../images/');
  static $count=0;
  if(array_key_exists('vid',$data)){
    $result=array();
    $result[]=$data;
    foreach($result as $one){
      $count++;
      echo '<td>'.$one['vid'].'</td>';
      echo '<td>'.$one['videoname'].'</td>';
      echo '<td>'.$one['tid'].'</td>';
      echo '<td align="center">
          <img src='.UserPhotoPath.$one['pic'].' width=100 height=120 alt="无海报"></td>';
      echo '<td>'.$one['intro'].'</td>';
      echo '<td>'.$one['uploaddate'].'</td>';
      echo '<td>'.$one['uploadadmin'].'</td>';
      echo '<td>'.$one['hittimes'].'</td>';
      echo '<td>'.$one['downtimes'].'</td>';
      echo '<td>'.$one['address'].'</td>';
      echo '<td>
      <a href="router.php?c=video&m=videoedit&id='.$one['vid'].' ">修改</a>| 
      <a href="router.php?c=video&m=delvideo&id='.$one['vid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a>
       </td>';
      echo '</tr>';  
    }
  }else{
    foreach($data as $one){
      $count++;
      echo '<td>'.$one['vid'].'</td>';
      echo '<td>'.$one['videoname'].'</td>';
      echo '<td>'.$one['tid'].'</td>';
      echo '<td align="center">
          <img src='.UserPhotoPath.$one['pic'].' width=100 height=120 alt="无海报"></td>';
      echo '<td>'.$one['intro'].'</td>';
      echo '<td>'.$one['uploaddate'].'</td>';
      echo '<td>'.$one['uploadadmin'].'</td>';
      echo '<td>'.$one['hittimes'].'</td>';
      echo '<td>'.$one['downtimes'].'</td>';
      echo '<td>'.$one['address'].'</td>';
      echo '<td>
      <a href="router.php?c=video&m=videoedit&id='.$one['vid'].' ">修改</a>| 
      <a href="router.php?c=video&m=delvideo&id='.$one['vid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a>
       </td>';
      echo '</tr>';  
    }
  }
  echo '</table>';  
  echo "<table align='center'><tr><td>共有 {$count} 名用户</td></tr></table>";   
 ?>
 </body>
</html>